(function(){
	if(window.commFun) return;
	
	function showLoading(){
		var showLoadingStr = '';
		showLoadingStr += '<div id="showLoadingMask" style="width:100%;height:100%;z-index:99;padding:0px 40px;position:absolute;top:0px;left:0px;background-color:rgba(1,1,1,.6);">';
        showLoadingStr += '<div style="position:absolute;top:160px;width:calc(100% - 80px);background-color:#fff;text-align:center;">';
        showLoadingStr += '<img alt="X" src="image/loading.jpg" style="width:80px;height:80px;margin:20px auto;">';
        showLoadingStr += '</div>';
        showLoadingStr += '</div>';
        if($('#showLoadingMask').length==0){
        	$('body').append(showLoadingStr);
        }
	}
	
	function closeLoading(){
		if($('#showLoadingMask').length>0){
			$('#showLoadingMask').remove();
        }
	}
	
	function showAlert(message){
        var showAlertStr = '';
        showAlertStr += '<div id="showAlertMask" style="width:100%;height:100%;z-index:99;padding:0px 40px;position:absolute;top:0px;left:0px;background-color:rgba(1,1,1,.6);">';
        showAlertStr += '<div style="position:absolute;top:160px;width:calc(100% - 80px);background-color:#fff">';
        showAlertStr += '<div style="height:40px;background-color:#12456c;padding:0px 20px;">';
        showAlertStr += '<span style="float:left;color:#fff;font-size:14px;line-height:40px;">信息</span>';
        showAlertStr += '<img alt="X" src="image/close_white.png" id="closeAlertMask" style="float:right;width:16px;height:16px;margin:12px 0px;">';
        showAlertStr += '</div>';
        showAlertStr += '<div style="padding:10px 20px;">';
        showAlertStr += '<p style="color:#333;font-size:12px;line-height:24px;text-align:center;">'+message+'</p>';
        showAlertStr += '</div>';
        showAlertStr += '</div>';
        showAlertStr += '</div>';
		if($('#showAlertMask').length==0){
			$('body').append(showAlertStr);
		}
        
        $('#closeAlertMask').on('click',function(){
        	$('#showAlertMask').remove();
        })
    }
	
	window.commFun = {
		showAlert: showAlert
		,showLoading: showLoading
		,closeLoading: closeLoading
	}
})();